// group_database.h
#ifndef GROUP_DATABASE_H
#define GROUP_DATABASE_H

#include <QObject>
#include <QSqlQuery>
#include <QString>
#include <QList>
#include "database_connection.h"
#include "group.h"
#include<QJsonObject>
class GroupDatabase : public QObject {
    Q_OBJECT
public:
    explicit GroupDatabase(DatabaseConnection *dbConnection, QObject *parent = nullptr);

    // 创建群聊
    int createGroup(const QString &groupName, int creatorId);
    // 添加群成员
    bool addGroupMember(int groupId, int userId);
    // 删除群成员
    bool removeGroupMember(int groupId, int userId);
    // 获取群成员列表
    QList<int> getGroupMembers(int groupId);
    // 发送群消息
    bool sendGroupMessage(int groupId, int senderId, const QString &messageText);
    // 获取群消息列表
    QList<QJsonObject> getGroupMessages(int groupId);

private:
    DatabaseConnection *dbConnection;
};

#endif // GROUP_DATABASE_H
